package com.github.config;

import com.github.interceptor.AuthInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private AuthInterceptor authInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns(
                        "/DbLgoin2025_Ab7cD2Ef9G.html",
                        "/css/bootstrap.min.css",
                        "/js/login.js",
                        "/api/auth/login",
                        "/api/server_login",
                        "/api/server_logout",
                        "/api/get_setting",
                        "/api/is_server_online"
                );
    }
}